<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简单计算机</title>
</head>

<body>
    <input type="text" id="n1">
    <select name="" id="opt">
    <option value="+">+</option>
    <option value="-">-</option>
    <option value="*">*</option>
    <option value="/">/</option>
    </select>
    <input type="text" id="n2">
    <span onclick="count()">=</span>
    <span id="res"></span>
</body>
<script>
    function count() {
        let n1 = document.getElementById("n1").value;
        let opt = document.getElementById("opt").value;
        let n2 = document.getElementById("n2").value;
        document.getElementById("res").innerHTML = eval(n1 + opt + n2)
    }
</script>

</html>